- PVM'd POV-Ray - Brad Kline, May 11 1994 ***** NOTE - This is an UNOFFICIAL modification to POV-Ray 2.2. ***** ** DO NOT SEND PROBLEM REPORTS TO THE POV TEAM REGARDING THESE MODIFICATIONS. ** The author disclaims all warranties with regard to this software, including all implied warranties of merchant-ability and fitness. The code is simply distributed as it is. I only ask that credit (or blame) is attributed to me for the original work. These files and modifications to POV-Ray 2.2 give POV the ability to distribute a rendering across multiple heterogeneous machines. The implementation vehicle is the Parallel Virtual Machine (PVM) System 3.2. PVM was developed by a team of people from the University of Tennesee, Oak Ridge National Laboratory, and Emory University. The effort was funded in part by the U.S. Department of Energy, the National Science Foundation and the State of Tennessee. The PVM source is not a part of this modification. You may get PVM 3.2 by sending E-mail to the NETLIB daemon "netlib@ornl.gov" with a subject line of "send index for PVM3" (NO quotes). This will reply with information about specific PVM 3.2 documentation and source file access. Theory of Operation ------------------- Using the PVM model, there is one master and many slave tasks. The master has the responsibility of issuing the work sections to the slaves, and receiving the rendered line segments back. It does not render any lines by itself. When a line segment is returned, the master writes it to the appropriate position in the output file. The PVM component is only activated if the user specifies the "-NMxx" option on the POV command line, where "xx" is the number of slaves to use. Absence of this option will have the same effect as using the original POV-Ray program. In other words, there will be only one task doing all the rendering. When the -NMxx option is specified, the program sub-divides the rendering into a number of grid sections. The width and depth of the sections are defaulted to 80 columns by 10 rows. These values may be modified by the -NWxx and the -NDxx options, respectively. It is important to note that by varying the grid sections in width and in depth, you can affect the performance of the rendering. If you have particular renderings that are very complex in a small portion of the display, then a finer grain may help. In this way, more of the tasks are able to migrate towards the grid sections that are more complex. You must also consider overhead if using anti-aliasing. Anti-aliasing requires the line segment above and below the grid section to be traced so that super-sampling may occur. If the depth of the grid is reduced in size, and anti-aliasing is turned on, your percentage of overhead goes up. For example, setting a depth of two (-ND2) using anti-aliasing would have an overhead of 50 percent. It is possible that reducing the column first would be a better way of testing the distribution scheme. For example, if I wanted to distribute an 800x600 rendering and use eight PVM tasks to do the work, I would use the -NM8 option, and let the PVM master define 600 80x10 sections. Eight slave tasks would be launched, and when ready, they would request work to do from the master. The master then issues a column and row range back to the requesting slave. As each line segment is completed, then the slave sends it back to the master, who writes the segment to disk. If all slaves did perfectly equal work in this example, they would have been issued 75 sections of work, and would have returned 750 line segments each. Note that the work issues are done one at a time. In this way, effective load balancing can occur. Tasks rendering the "easy" sections will eventually all migrate towards the harder sections. Seriously imbalanced distributions will be seen by widely varying percentages shown at the end of the rendering. The more evenly the tasks are distributed, the better the load balance. Additional Options to POV-Ray 2.2: ---------------------------------- -NMxx - Use xx number of slave tasks. -NAxxxx - Only run on architecture type xxxx (See PVM documents). -NDxx - Set PVM distribution grid depth to xx. -NWxx - Set PVM distribution grid width to xx. Known restrictions / bugs: -------------------------- - Statistics are not send back to the master. - Restarting a partial rendering will not work. Installing and building PVM'd POV-Ray: -------------------------------------- Unload the TAR package into a your POV-Ray source directory. Example: % cd povray2/source % zcat PVMPOV.TAR | tar xf - Configuration ------------- There is a getcwd() call in pvm.c. If your system uses getwd() instead, modify the GETCWD define in pvm.h. Files in this package: ---------------------- pvm.h - Include file for PVM related files. pvm.c - The main routines that manage the PVM tasks. This file references "pvm3.h", which is a part of the PVM package. pvm.mak - A modified UNIX.MAK makefile that includes these new files and references the PVM library -> libpvm3.a. You must get libpvm3.a from the PVM team noted above. Also, I have it set up to use xwindows.c. You may need to change that to the generic unix.c file. Since the POV-Ray make file was declared public domain, I simply released the file in total. difflist.txt - A complete diff of the affected files in the original POV-Ray source. (original = "<" and new = ">"). ediff.frame - A "diff -e" of frame.h. See below on how to update the origi- nal file using ed(1). ediff.povray - A "diff -e" of povray.c. ediff.render - A "diff -e" of render.c. By using "ed", you may update the original source file to the modified file as in the following example. *** NOTE - Be sure to back up the original files before doing this!! *** % ed -s frame.h < ediff.frame % ed -s povray.c < ediff.povray % ed -s render.c < ediff.render To build the product, you may have to modify pvm.mak to suit your local file and directory structure. Be sure you have PVM installed, and have access to pvm3.h and libpvm3.a. The pvm.mak file builds an a.out called "pvmpovray". This was done so that there is a distinction between this and the original POV-ray a.out. Execution example: ------------------ You first must have a PVM daemon launched on each machine that will be participating in the rendering. Refer to the PVM 3.2 documentation. The following is an example I use to start PVM on a group of sixteen SOLARIS based SPARCstation-5's. My home directory is auto-mounted to all of these hosts, so I reference the same directory in all cases. I also keep pvmpovray installed in a directory called "bin", relative to my home directory. % cat pvm.hosts sun501 dx=./bin/pvmd3 ep=./bin sun502 dx=./bin/pvmd3 ep=./bin sun503 dx=./bin/pvmd3 ep=./bin sun504 dx=./bin/pvmd3 ep=./bin sun505 dx=./bin/pvmd3 ep=./bin sun506 dx=./bin/pvmd3 ep=./bin sun507 dx=./bin/pvmd3 ep=./bin sun508 dx=./bin/pvmd3 ep=./bin sun509 dx=./bin/pvmd3 ep=./bin sun510 dx=./bin/pvmd3 ep=./bin sun511 dx=./bin/pvmd3 ep=./bin sun512 dx=./bin/pvmd3 ep=./bin sun513 dx=./bin/pvmd3 ep=./bin sun514 dx=./bin/pvmd3 ep=./bin sun515 dx=./bin/pvmd3 ep=./bin sun516 dx=./bin/pvmd3 ep=./bin The following command launches the PVM daemons. % /pvmd3 pvm.hosts Now that the PVM daemons are up and waiting for work to do, we can render. % pvmpovray bnch.def -Iskyvase.pov -Oskyvase.tga -NM16 Persistence of Vision Raytracer Ver 2.2.u This is an unofficial version compiled by: Brad Kline - PVM Version ................. The POV-Ray Team is not responsible for supporting this version. Copyright 1993 POV-Team ---------------------------------------------------------------------- POV-Ray is based on DKBTrace 2.12 by David K. Buck & Aaron A. Collins. Contributing Authors: (Alphabetically) Steve Anger Steve A. Bennett David K. Buck Aaron A. Collins Alexander Enzmann Dan Farmer Douglas Muir Bill Pulver Robert Skinner Scott Taylor Drew Wells Chris Young Other contributors listed in the documentation. ---------------------------------------------------------------------- POV-Ray Options in effect: +v1 +ft +mb25 +nm16 +nw80 +nd10 +a0.300 +j1.000 +r3 -q9 -w640 -h480 -s1 -e480 -k0.000 -mv2.0 -iskyvase.pov -oskyvase.tga -l./include Parsing.......... Preprocessing... POV-Ray rendering skyvase.pov to skyvase.tga : PVM Task Distribution: Tasks-16 Grid width-80 Grid Depth-10 Sections-384 Res 640 X 480. 480 of 480 lines completed. PVM Task Distribution Statistics: Task[ 0] 6.25% Task[ 1] 7.55% Task[ 2] 6.25% Task[ 3] 5.73% Task[ 4] 5.99% Task[ 5] 6.77% Task[ 6] 6.25% Task[ 7] 6.25% Task[ 8] 6.51% Task[ 9] 6.25% Task[ 10] 7.03% Task[ 11] 4.95% Task[ 12] 5.99% Task[ 13] 6.51% Task[ 14] 5.99% Task[ 15] 5.73% Time For Trace: 0 hours 0 minutes 37.00 seconds % ------ Enjoy! Brad Kline jbk@cray.com